package com.ecp.commons.db;

import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONObject;

import com.ecp.commons.bean.Page;
import com.ecp.commons.serialization.SerializableObject;

public interface MongoDAO<T extends SerializableObject> {
	T load(long id, T t);

	long add(T t) throws Exception;

	void delete(long id, T t);

	void update(T t);

	T getEntity(Map<String, Object> condition, T t);

	List<T> getEntityList(Map<String, Object> condition, T t, Page page, String orderby);

	//long generateId2(String tableName) throws Exception;

	JSONObject toJSON(T t, String[] keys);

	JSONObject toJSON(T t, String[] keys, String prefix);

	JSONArray toJSONArray(List<T> list, String[] keys);

}
